<template>
	<view>
		<cu-custom :isBack="true" bgColor="bg-blue">
			<block slot="content">粗轧区域监控</block>
			<template slot="backText">
				<text class="cuIcon-back" @tap="beforePage"></text>
			</template>
		</cu-custom>
		<!-- 主题内容 -->
		<view  class="padding-t">
			<view class="public-main-info">
				<view class="u-main">
					<view class="u-main-title">
						<view>炉区通信监控</view>
						<view class="font-size22 flex" style="width: 200upx;">
							<view class="success"><text class="margin-left-10">正常</text></view>
							<view class="warn"><text class="margin-left-10">故障</text></view>
						</view>
					</view>
					<view class="u-main-line"></view>
					<view class="padding2030 font-size22">
						<view class="aaa">
							<view :class="['plc110', luqu.plc110 == 1 ? 'text-blue' : 'text-red']">PLC110</view>
							<view :class="['plc110IO', luqu.plc110IO == 1 ? 'text-blue' : 'text-red']">PLC110_IO</view>
							<view :class="['AIO0111', luqu.AIO0111 == 1 ? 'text-blue' : 'text-red']">AIO01-11</view>
							<view :class="['AOS012', luqu.AOS012 == 1 ? 'text-blue' : 'text-red']">AOS01-2</view>
							<view :class="['AOS011', luqu.plc110 == 1 ? 'text-blue' : 'text-red']">AOS01-1</view>
							<view :class="['ban', luqu.AOS011 == 1 ? 'text-blue' : 'text-red']">板坯称</view>
							
							<view :class="['cu1', luqu.cu1 == 1 ? 'text-blue' : 'text-red']">传动CU1</view>
							<view :class="['cu2', luqu.cu2 == 1 ? 'text-blue' : 'text-red']">传动CU2</view>
							<view :class="['cu3', luqu.cu3 == 1 ? 'text-blue' : 'text-red']">传动CU3</view>
							<view :class="['cu4', luqu.cu4 == 1 ? 'text-blue' : 'text-red']">传动CU4</view>
							<view :class="['cu5', luqu.cu5 == 1 ? 'text-blue' : 'text-red']">传动CU5</view>
							<view :class="['cu6', luqu.cu6 == 1 ? 'text-blue' : 'text-red']">传动CU6</view>
						</view>
					</view>
				</view>
				
				<view class="u-main">
					<view class="u-main-title">
						<view>粗轧通信监控</view>
						<view class="font-size22 flex" style="width: 200upx;">
							<view class="success"><text class="margin-left-10">正常</text></view>
							<view class="warn"><text class="margin-left-10">故障</text></view>
						</view>
					</view>
					<view class="u-main-line"></view>
					<view class="padding-tb-20 font-size22">
						<view class="cu-tongxin">
							<view :class="['plc110', cuInfo.AIO0211 == 0 ? 'text-blue' : 'text-red']">AIO02-11</view>
							<view :class="['plc110IO', cuInfo.TDC21010 == 0 ? 'text-blue' : 'text-red']">TDC210-10</view>
							<view :class="['AIO0111', cuInfo.AIO0215 == 0 ? 'text-blue' : 'text-red']">AIO02-15</view>
							<view :class="['AOS012', cuInfo.AOS021 == 0 ? 'text-blue' : 'text-red']">AOS02-1</view>
							<view :class="['AOS026', cuInfo.AOS026 == 0 ? 'text-blue' : 'text-red']">AOS02-6</view>
							<view :class="['cuDownChuan', cuInfo.cuDownChuan == 0 ? 'text-blue' : 'text-red']">粗轧压下传动</view>
							
							<view :class="['R1UpRoll', cuInfo.R1UpRoll == 0 ? 'text-blue' : 'text-red']">
								<view>R1上辊</view>
								<view>主传动</view>
							</view>
							<view :class="['R1DownRoll', cuInfo.R1DownRoll == 0 ? 'text-blue' : 'text-red']">
								<view>R1下辊</view>
								<view>主传动</view>
							</view>
							<view :class="['E1CaoCe', cuInfo.E1CaoCe == 0 ? 'text-blue' : 'text-red']">
								<view>E1操作侧</view>
								<view>立辊传动</view>
							</view>
							<view :class="['E1ChuanCe', cuInfo.E1ChuanCe == 0 ? 'text-blue' : 'text-red']">
								<view>E1传动侧</view>
								<view>立辊传动</view>
							</view>
							<view :class="['cuRollCU1', cuInfo.cuRollCU1 == 0 ? 'text-blue' : 'text-red']">
								<view>粗轧辊道</view>
								<view>CU1</view>
							</view>
							<view :class="['cuRollCU2', cuInfo.cuRollCU2 == 0 ? 'text-blue' : 'text-red']">
								<view>粗轧辊道</view>
								<view>CU2</view>
							</view>
							<view :class="['cuRollCU3', cuInfo.cuRollCU3 == 0 ? 'text-blue' : 'text-red']">
								<view>粗轧辊道</view>
								<view>CU3</view>
							</view>
							
							<view :class="['FaultB16', cuInfo.FaultB16 == 0 ? 'text-blue' : 'text-red']">PLC720</view>
							<view :class="['FaultB17', cuInfo.FaultB17 == 0 ? 'text-blue' : 'text-red']">
								<view>AOC07</view>
								<view>-21</view>
							</view>
							<view :class="['FaultB18', cuInfo.FaultB18 == 0 ? 'text-blue' : 'text-red']">
								<view>AOC07</view>
								<view>-22</view>
							</view>
							<view :class="['FaultB19', cuInfo.FaultB19 == 0 ? 'text-blue' : 'text-red']">
								<view>AOC07</view>
								<view>-24</view>
							</view>
							<view :class="['FaultB20', cuInfo.FaultB20 == 0 ? 'text-blue' : 'text-red']">
								<view>AOC07</view>
								<view>-25</view>
							</view>
							<view :class="['FaultB21', cuInfo.FaultB21 == 0 ? 'text-blue' : 'text-red']">
								<view>241G06</view>
								<view>-MCC</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-tabbar-height"></view>
	</view>
</template>

<script>
	import { post } from "@/lib/Util.js";
	export default {
		data() {
			return {
				timer: null,
				luqu: {
					plc110: null,
					plc110IO: null,
					AIO0111: null,
					AOS012: null,
					AOS011: null,
					ban: null,
					cu1: null,
					cu2: null,
					cu3: null,
					cu4: null,
					cu5: null,
					cu6: null
				},
				cuInfo: {
					AIO0211: null,
					TDC21010: null,
					AIO0215: null,
					AOS021: null,
					AOS026: null,
					cuDownChuan: null,
					R1UpRoll: null,
					R1DownRoll: null,
					E1CaoCe: null,
					E1ChuanCe: null,
					cuRollCU1:null,
					cuRollCU2: null,
					cuRollCU3: null,
					FaultB16: null,
					FaultB17: null,
					FaultB18: null,
					FaultB19: null,
					FaultB20: null,
					FaultB21: null,
				}
			}
		},
		created() {
			this.getInfo()
			this.getCuInfo()
		},
		mounted() {
			this.timer = setInterval(()=> {
				this.getInfo()
				this.getCuInfo()
			}, 10000)
		},
		beforeDestroy() {
			clearInterval(this.timer)
			this.timer = null
		},
		methods:{
			beforePage() {
				uni.navigateBack({
					delta: 1
				});
			},
			async getInfo() {
				let Fault_B0 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "FCE_SCAN.Fault_B0",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B1 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B1",
						  ts: "1"
						}
					  ]
				})
				let Fault_B2 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B2",
						  ts: "1"
						}
					  ]
				})
				let Fault_B3 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B3",
						  ts: "1"
						}
					  ]
				})
				let Fault_B4 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B4",
						  ts: "1"
						}
					  ]
				})
				let Fault_B11 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B11",
						  ts: "1"
						}
					  ]
				})
				this.luqu.plc110 = Fault_B0.data.tagList[0].value
				this.luqu.plc110IO = Fault_B1.data.tagList[0].value
				this.luqu.AIO0111 = Fault_B2.data.tagList[0].value
				this.luqu.AOS012 = Fault_B3.data.tagList[0].value
				this.luqu.AOS011 = Fault_B4.data.tagList[0].value
				this.luqu.ban = Fault_B11.data.tagList[0].value
				
				let Fault_B5 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B5",
						  ts: "1"
						}
					  ]
				})
				let Fault_B6 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B6",
						  ts: "1"
						}
					  ]
				})
				let Fault_B7 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B7",
						  ts: "1"
						}
					  ]
				})
				let Fault_B8 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B8",
						  ts: "1"
						}
					  ]
				})
				let Fault_B9 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B9",
						  ts: "1"
						}
					  ]
				})
				let Fault_B10 = await post('/webservice/getHmiData', {
					tags: [
						{
						  name: "FCE_SCAN.Fault_B10",
						  ts: "1"
						}
					  ]
				})
				
				this.luqu.cu1 = Fault_B5.data.tagList[0].value
				this.luqu.cu2 = Fault_B6.data.tagList[0].value
				this.luqu.cu3 = Fault_B7.data.tagList[0].value
				this.luqu.cu4 = Fault_B8.data.tagList[0].value
				this.luqu.cu5 = Fault_B9.data.tagList[0].value
				this.luqu.cu6 = Fault_B10.data.tagList[0].value
			},
			async getCuInfo() {
				let Fault_B1 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B1",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B11 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B11",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B12 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B12",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B13 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B13",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B14 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B14",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B6 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B6",
					      ts: "1"
					    }
					  ]
				})
				this.cuInfo.AIO0211 = Fault_B1.data.tagList[0].value
				this.cuInfo.TDC21010 = Fault_B11.data.tagList[0].value
				this.cuInfo.AIO0215 = Fault_B12.data.tagList[0].value
				this.cuInfo.AOS021 = Fault_B13.data.tagList[0].value
				this.cuInfo.AOS026 = Fault_B14.data.tagList[0].value
				this.cuInfo.cuDownChuan = Fault_B6.data.tagList[0].value
				let Fault_B2 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B2",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B3 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B3",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B4 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B4",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B5 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B5",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B7 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B7",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B8 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B8",
					      ts: "2"
					    }
					  ]
				})
				let Fault_B9 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B9",
					      ts: "2"
					    }
					  ]
				})
				this.cuInfo.R1UpRoll = Fault_B2.data.tagList[0].value
				this.cuInfo.R1DownRoll = Fault_B3.data.tagList[0].value
				this.cuInfo.E1CaoCe = Fault_B4.data.tagList[0].value
				this.cuInfo.E1ChuanCe = Fault_B5.data.tagList[0].value
				this.cuInfo.cuRollCU1 = Fault_B7.data.tagList[0].value
				this.cuInfo.cuRollCU2 = Fault_B8.data.tagList[0].value
				this.cuInfo.cuRollCU3 = Fault_B9.data.tagList[0].value
				
				let Fault_B16 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B16",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B17 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B17",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B18 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B18",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B19 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B19",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B20 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B20",
					      ts: "1"
					    }
					  ]
				})
				let Fault_B21 = await post('/webservice/getHmiData', {
					tags: [
					    {
					      name: "RM_SCAN.Fault_B21",
					      ts: "1"
					    }
					  ]
				})
				
				this.cuInfo.FaultB16 = Fault_B16.data.tagList[0].value
				this.cuInfo.FaultB17 = Fault_B17.data.tagList[0].value
				this.cuInfo.FaultB18 = Fault_B18.data.tagList[0].value
				this.cuInfo.FaultB19 = Fault_B19.data.tagList[0].value
				this.cuInfo.FaultB20 = Fault_B20.data.tagList[0].value
				this.cuInfo.FaultB21 = Fault_B21.data.tagList[0].value
			}
		}
	}
</script>

<style>
	.aaa {
		background-image: url(../../../static/img/xinlu.png);
		background-size: 100% 80%;
		-moz-background-size: 100% 80%;
		background-position: 0px 30upx ;
		background-repeat: no-repeat;
		width: 100%;
		height: 341upx;
		position: relative;
	}
	.cu-tongxin {
		background-image: url(../../../static/img/xincu.png);
		background-size: 100% 90%;
		background-position: 0px 30upx ;
		-moz-background-size: 100% 90%;
		background-repeat: no-repeat;
		width: 100%;
		height: 640upx;
		position: relative;
	}
	.plc110 {
		position: absolute;
	}
	.plc110IO {
		position: absolute;
		left: 112upx;
	}
	.AIO0111 {
		position: absolute;
		left: 250upx;
	}
	.AOS012 {
		position: absolute;
		left: 380upx;
	}
	.AOS011 {
		position: absolute;
		left: 510upx;
	}
	.ban {
		position: absolute;
		left: 622upx;
	}
	.cu1 {
		position: absolute;
		bottom: 2upx;
	}
	.cu2 {
		position: absolute;
		bottom: 2upx;
		left: 112upx;
	}
	.cu3 {
		position: absolute;
		bottom: 2upx;
		left: 250upx;
	}
	.cu4{
		position: absolute;
		bottom: 2upx;
		left: 380upx;
	}
	.cu5 {
		position: absolute;
		bottom: 2upx;
		left: 500upx;
	}
	.cu6 {
		position: absolute;
		bottom: 2upx;
		left: 600upx;
	}
	
	/* 粗轧 */
	.AOS026 {
		position: absolute;
		left: 490upx;
	}
	.cuDownChuan {
		position: absolute;
		left: 600upx;
	}
	.R1UpRoll {
		position: absolute;
		top: 47%;
		left: 10upx;
	}
	.R1DownRoll {
		position: absolute;
		top: 47%;
		left: 110upx;
	}
	.E1CaoCe {
		position: absolute;
		top: 47%;
		left: 190upx;
	}
	.E1ChuanCe {
		position: absolute;
		top: 47%;
		left: 300upx;
	}
	.cuRollCU1 {
		position: absolute;
		top: 47%;
		left: 420upx;
	}
	.cuRollCU2 {
		position: absolute;
		top: 47%;
		left: 520upx;
	}
	.cuRollCU3 {
		position: absolute;
		top: 47%;
		left: 620upx;
	}
	.FaultB16 {
		position: absolute;
		bottom: 2upx;
		left: 30upx;
	}
	.FaultB17 {
		position: absolute;
		bottom: -18upx;
		left: 150upx;
	}
	.FaultB18 {
		position: absolute;
		bottom: -18upx;
		left: 270upx;
	}
	.FaultB19 {
		position: absolute;
		bottom: -18upx;
		left: 390upx;
	}
	.FaultB20 {
		position: absolute;
		bottom: -18upx;
		left: 510upx;
	}
	.FaultB21 {
		position: absolute;
		bottom: -18upx;
		left: 640upx;
	}
</style>

